home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / lcsrc.arc / CRT_CLS2.ASM < prev    next >
Assembly Source File  |  1985-04-06  |  2KB  |  87 lines

  1.  
  2.  
  3. ;----------------------- this one needs work ---------------------------
  4. ;
  5. ; name        crt_cls2 - clear screen or graphics buffer
  6. ;
  7. ; synopsis    crt_cls2(segment,offset)
  8. ;            int segment;    
  9. ;            int offset;
  10. ;
  11. ;
  12. ; description    this routine uses the REP MOVSW instruction for fast
  13. ;        clearing of the screen or a graphics buffer. Use segment
  14. ;        0xb000 and offset 0 for mono, segment 0xb800 and offset
  15. ;        0 for color.  To clear a graphics buffer, use the appro-
  16. ;        priate segment and offset values.  Large model pointers
  17. ;        must be separated into segment and offset values which
  18. ;        must be passed separately.
  19. ;
  20. ; notes        on some machines, this routine is significantly faster
  21. ;        than a screen clear using the BIOS screen scroll up
  22. ;        routine.  
  23. ;
  24. ;        DI register destroyed.  ES register used and
  25. ;        then restored.
  26. ;
  27. ;        If used in text modes, it clears ALL text pages.
  28. ;-----------------------------------------------------------------------
  29.  
  30.  
  31.  
  32.     include    dos.mac
  33.  
  34.  
  35.     IF    LPROG
  36. X    EQU    6        ;OFFSET OF ARGUMENTS
  37.     ELSE
  38. X    EQU    4        ;OFFSET OF ARGUMENTS
  39.     ENDIF
  40.  
  41.  
  42. SEGM    equ    [bp+x+2]
  43. OFFS    equ    [bp+x+4]
  44.  
  45.     PSEG
  46.  
  47.  
  48.     PUBLIC    crt_cls2
  49.  
  50.     IF    LPROG
  51. crt_cls2    PROC    FAR
  52.     ELSE
  53. crt_cls2    PROC    NEAR
  54.     ENDIF
  55.  
  56.  
  57.     push    bp
  58.     push    es
  59.     mov    bp,sp
  60.     mov    ax,SEGM
  61.     mov    es,ax            ; set es to color video segment
  62.  
  63.     mov    di,OFFS            ; offset to graphics ram
  64.     mov    cx,4000            ; # words to fill
  65.     mov    ax,0
  66.     cld
  67.     rep    stosw
  68.  
  69.     mov    ax,SEGM
  70.     add    ax,2000h
  71.     mov    di,ax        ; offset to graphics ram
  72.     mov    cx,4000        ; # words to fill
  73.     mov    ax,0
  74.     cld
  75.     rep    stosw
  76.  
  77.     pop    es
  78.     pop    bp        ; restore registers
  79.     ret
  80.  
  81. crt_cls2    endp
  82.  
  83.     ENDPS    
  84.     END
  85.  
  86.  
  87.